<?php
session_start();
include("db_conn_new.inc");

if(isset($_POST['sigcode1']) && isset($_POST['sigcode2']))
{
	
	$app_id = $_SESSION['app_id'];
	$sigcode1 = $_POST['sigcode1']; 
	
	/*echo $sigcode1;
	exit;*/
	//$sigcode2 = preg_replace('/^([\'"])(.*)\\1$/', '\\2', $_POST['sigcode2']);
	$sigcode2 =  mysql_real_escape_string($_POST['sigcode2']);
	
	$sql = "UPDATE crm_loancontract SET SignCode = '".$sigcode2."', SignCodeBackup = '".$sigcode1."' WHERE app_id = ".$app_id;
	//echo $sql;
	if(!$res = mysql_query($sql))
		echo mysql_error();
	
	/*$res = mysql_query($sql);*/ 
	

	if($res){ 
		$status = mysql_query("UPDATE sacc_verificationstatus SET contractsigned = 1 WHERE app_id = ".$app_id);
		echo $status;
		if($status ){
			echo 'success';
		}else{
			echo 'failed';
		} 
				
	}
	
}


?>

